﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Ledict.Core.Data;
using System.Data.Common;
using Ledict.ConditionExtract.Model;
using Ledict.ConditionExtract.Common;

namespace Ledict.ConditionExtract.DAL
{
   public class XmlLabel_LabelRelDAL
    { 
       private string DbName;
       public XmlLabel_LabelRelDAL()
        {
            DbName = "JudgeDoc";
        }

       
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataTable GetList(string CC_ID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select  a.*,b.CC_RegexInfoCode FROM SYS_XmlLabel_LabelRel as a 
            join dbo.SYS_Express_Source as b
            on a.CaseCauseID=CC_ID
            where CaseCauseID=@CaseCauseID
            and Source_ID='JudgeBook'");

            Database oBase = DatabaseFactory.CreateDatabase(DbName);
            DbCommand oCmd = oBase.GetSqlStringCommand(strSql.ToString());
            oBase.AddInParameter(oCmd, "@CaseCauseID", DbType.String, CC_ID);

            DataTable OtB = oBase.ExecuteDataSet(oCmd).Tables[0];
            if (OtB.Rows.Count > 0)
            {
                return OtB;
            }
            else
            {
                return new DataTable();
            }



        }







    }
}
